package com.aifast.common.desensitize;

import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;

public class AiFastDesensitizeIntrospector extends NopAnnotationIntrospector {

    @Override
    public Object findSerializer(Annotated am) {
        Desensitize ann = am.getAnnotation(Desensitize.class);
        if (ObjectUtil.isNotNull(ann)) {
            return new AiFastDesensitizeSerializer(ann.value());
        }
        return super.findSerializer(am);
    }
}
